# $Id$
# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=libtiff
pkgver=4.0.8
pkgrel=2
pkgdesc="Library for manipulation of TIFF images"
arch=('i686' 'x86_64')
url="http://www.simplesystems.org/libtiff/"
license=('custom')
depends=('libjpeg' 'zlib' 'xz')
makedepends=('freeglut' 'glu' 'mesa' 'jbigkit')
optdepends=('freeglut: for using tiffgt')
source=(http://download.osgeo.org/libtiff/tiff-${pkgver}.tar.gz
        CVE-2016-10095.patch)
sha256sums=('59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910'
            '36063a31e9317c3745b5e03b210c948586ea469205b06d3dde2e1b2493f18d81')

prepare() {
  cd tiff-$pkgver
  patch -p1 -i ../CVE-2016-10095.patch # Fix several security issues
}

build() {
  cd tiff-${pkgver}
  ./configure --prefix=/usr
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd tiff-${pkgver}
  make check
}

package() {
  cd tiff-${pkgver}
  make DESTDIR="${pkgdir}" install
  install -D -m644 COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
